﻿Public Class Item
    Dim ID As Integer
    Dim BaseType As String
    Dim ExtendedType As String

    Public Property ItemID() As String
        Get
            Return ID
        End Get
        Set(ByVal Value As String)
            If Not Convert.IsDBNull(Value) Then
                ID = Value
            Else
                ID = ""
            End If
        End Set
    End Property

    Public Property ItemBaseType() As String
        Get
            Return BaseType
        End Get
        Set(ByVal Value As String)
            If Not Convert.IsDBNull(Value) Then
                BaseType = Value
            Else
                BaseType = ""
            End If
        End Set
    End Property

    Public Property ItemExtendedType() As String
        Get
            Return ExtendedType
        End Get
        Set(ByVal Value As String)
            If Not Convert.IsDBNull(Value) Then
                ExtendedType = Value
            Else
                ExtendedType = ""
            End If
        End Set
    End Property

    Public Sub New(ByVal iItemArrayIndex As Integer)
        MyBase.New()
        ItemID = iItemArrayIndex
        ItemBaseType = ItemBaseTypeLookup(Roll(1, 5))
        ItemExtendedType = ItemExtendedTypeLookup(BaseType, Roll(1, 5))
    End Sub


#Region "Lookup Tables"
    Private Function ItemBaseTypeLookup(ByVal i As Integer)
        Select Case i
            Case 1
                BaseType = "Armor"
            Case 2
                BaseType = "Weapon"
            Case 3
                BaseType = "Potion"
            Case 4
                BaseType = "Material"
            Case 5
                BaseType = "Consumable"
            Case Else
                BaseType = "Junk"
        End Select

        Return BaseType
    End Function

    Private Function ItemExtendedTypeLookup(ByVal BaseType As String, ByVal i As Integer)
        Select Case BaseType
            Case "Armor"
                Select Case i
                    Case 1
                        ExtendedType = "Head Armor"
                    Case 2
                        ExtendedType = "Shoulder Armor"
                    Case 3
                        ExtendedType = "Back Armor"
                    Case 4
                        ExtendedType = "Chest Armor"
                    Case 5
                        ExtendedType = "Wrist Armor"
                    Case 6
                        ExtendedType = "Hand Armor"
                    Case 7
                        ExtendedType = "Leg Armor"
                    Case 8
                        ExtendedType = "Foot Armor"
                End Select
            Case Else
        End Select


        Return ExtendedType
    End Function
#End Region
End Class
